const log4js = require('log4js')
log4js.configure({
  appenders: {
    out: { type: 'stdout' },
    app: { type: 'file', filename: './log/app.log' },
    api: { type: 'file', filename: './log/api.log' },
    default: { type: 'file', filename: './log/default.log' },
  },
  categories: {
    app: {
      appenders: ['out', 'app'],
      level: process.env.LOG_LEVEL,
    },
    api: {
      appenders: ['out', 'api'],
      level: process.env.LOG_LEVEL,
    },
    default: {
      appenders: ['out', 'default'],
      level: process.env.LOG_LEVEL,
    },
  },
  pm2: true,
})
var app = log4js.getLogger('app')
var api = log4js.getLogger('api')
module.exports = { app, api }
